package org.szy.monitor.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.annotation.SaMode;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Context;
import org.noear.solon.core.handle.MethodType;
import org.noear.solon.core.handle.ModelAndView;
import org.szy.core.common.controller.BaseController;
import org.szy.monitor.server.Server;

/**
 * TODO 描述内容
 *
 * @author 孙志阳
 * @date 2023-06-30
 * @since 1.0.0
 **/
@Controller
@Mapping("/monitor/server")
public class ServerController extends BaseController {


    private static String PATH_PREFIX = "monitor/server/";

    @Mapping(path = "", method = MethodType.GET)
    @SaCheckPermission(value = "monitor_server", mode = SaMode.OR, orRole = "wangbuhao")
    public ModelAndView index(Context ctx) {

        ModelAndView mav = new ModelAndView(PATH_PREFIX + "index");

        Server server = new Server();
        try {
            server.copyTo();
            mav.put("server", server);
        } catch (Exception ignored) {
        }

        return mav;
    }

}
